document.addEventListener("DOMContentLoaded", () => {
  setTimeout(() => {
    document.body.classList.add("sidenav-pinned");
    document.body.classList.add("ready");
  }, 200);
});

const toastBox = document.querySelector("#myToast");
const toast = new bootstrap.Toast(toastBox);
const tip = (msg) => {
  toastBox.querySelector(".toast-body").innerHTML = msg;
  toast.show();
};

axios.defaults.baseURL = "http://ajax-api.itheima.net";

const post = (url,data) =>{
return axios({url, method: 'post',data})
}
const get = (url, data) => {
  return axios({method: "get",url,params: data});
};


axios.interceptors.response.use(
    function (config) {
    config.headers.Authorization = localStorage.getItem('token')
    return config;
  }, function (error) {
    return Promise.reject(error);
  }
);


